<?php
	$fields_arr = array(
		'name'=>'导航名称',
		'url'=>'链接地址',
		'addtime'=>'添加时间',
		'edittime'=>'修改时间',
		'display'=>'显示',
		'blank'=>'新窗口打开',
		'manager_name'=>'添加人',
		'operation'=>'操作',
	);
	if(!$custom_field_arr){
		$custom_field_arr = array_flip($fields_arr);
	}
	$fields_arr_new = array_merge($custom_field_arr,array_flip($fields_arr));
	$fields_arr_new = array_unique($fields_arr_new);
?>
{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}
<link rel="stylesheet" href="/res/js/framework/nestable/nestable.css">
<div class="container-fluid content-body">
	<div class="main">

		<section class="left-section">
			<dl id="leftNav" data-type="setting">
				<dt><i class="glyphicon glyphicon-wrench"></i> 网站设置</dt>
				{if in_case_array('admin/setting',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/setting/index}">站点设置</a></dd>
				{/if}
				{if in_case_array('admin/nav',$priv) || empty($priv)}
				<dd><a class="mb active" href="{url /admin/nav/index}">导航设置</a></dd>
				{/if}
				{if in_case_array('admin/friendLink',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/friendLink/index}">友情链接</a></dd>
				{/if}
				{if in_case_array('admin/remind',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/remind/index}">站内提醒</a></dd>
				{/if}
				{if in_case_array('admin/remindSms',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/remindSms/index}">短信提醒</a></dd>
				{/if}
				{if in_case_array('admin/security',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/security/index}">安全中心</a></dd>
				{/if}
				{if in_case_array('admin/remind',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/message/index}">消息中心</a></dd>
				{/if}
				{if in_case_array('admin/loginlog',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/LoginLog/index}">登录日志</a></dd>
				{/if}
				{if in_case_array('admin/operationlog',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/operationLog/index}">操作日志</a></dd>
				{/if}
			</dl>
		</section>

		<section class="right-section" id="right-section">
			{include admin.inc.bread}
			<h2 class="header">{$title}</h2>
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				<div class="inner-container">
					<form class="form-inline search-form" role="form" id="J_List_Form">
						<nav class="inline-form">
							<a class="btnlg mb" href="{$add_url}"><i class="css-add"></i>添加导航</a>
							<div class="r">
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											导航名称
										</div>
										<input type="text" class="form-control input-sm" maxlength="20" placeholder="导航名称" name="s_name" value="{$s_name}">
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											显示
										</div>
										<div class="css-select">
											<div class="chosen">
												<span></span>
												<i class="angle-down"></i>
												<input type="hidden" name="s_display" value="{$s_display}">
											</div>
											<ul>
												<li data-value="">--请选择--</li>
												<li data-value="1">显示</li>
												<li data-value="0">隐藏</li>
											</ul>
										</div>
									</div>
								</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											新窗口打开
										</div>
										<div class="css-select">
											<div class="chosen">
												<span></span>
												<i class="angle-down"></i>
												<input type="hidden" name="s_blank" value="{$s_blank}">
											</div>
											<ul>
												<li data-value="">--请选择--</li>
												<li data-value="1">是</li>
												<li data-value="0">否</li>
											</ul>
										</div>
									</div>
								</div>
								<input type="hidden" name="order" value="{$order}">
								<button type="submit" class="btnlg mb">搜索</button>
								<input type="hidden" name="pagesize" value="{$pagesize}" >
								<button type="button" class="btnlg mb" id="defined">配置列表项</button>
							</div>
						</nav>

					<!--</form>
					<form id="J_List_Form">-->
						<div class="table-responsive">
							<table id="J_ListTable" class="table  table-hover  table-striped">
								<thead>
									<tr>
										<th width="20">
											<label class="css-checkbox">
												<input type="checkbox" class="check-all">
												<span></span>
											</label>
										</th>
										{loop $custom_field_arr $k $v}
										<th>{$fields_arr[$v]}</th>
										{/loop}
									</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td style="text-align:center;" colspan="9" class="empty-table-td">{$emptyRecord}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td>
										<label class="css-checkbox">
											<input type="checkbox"  name="ids[]" value="{$value[id]}">
											<span></span>
										</label>
									</td>
									{loop $custom_field_arr $v}
									{if $v=='display'}
									<td>
										{if $value[name]=='首页' ||$value[name]=='交易市场'}
										<a class="btn btn-primary btn-xs disabled" title="系统默认不可编辑">系统默认</a>
										{else}
										<label class="css-switch">
											<input type="checkbox" class="check_display" data-id="{$value[id]}" data-size="mini"
												   {if $value[display]}checked{/if} data-on-text="是" data-off-text="否">
											<span></span>
										</label>
										{/if}
									</td>
									{else}
									{if $v=='blank'}
									<td>
										{if $value[name]=='首页' ||$value[name]=='交易市场'}
										<a class="btn btn-primary btn-xs disabled" title="系统默认不可编辑">系统默认</a>
										{else}
										<label class="css-switch">
											<input type="checkbox" class="check_blank" data-id="{$value[id]}" data-size="mini"
												   {if $value[blank]}checked{/if} data-on-text="是" data-off-text="否">
											<span></span>
										</label>
										{/if}
									</td>
									{else}
									{if $v=='operation'}
									<td>
										{if $value['is_default']==1}
										<a class="btn btn-primary btn-xs disabled">系统默认</a>
										{else}
										{if in_array('admin/nav/edit',$priv) || empty($priv)}
										<a href="{$edit_url}?id={$value[id]}" class="btnsm-primary">编辑</a>
										{/if}
										{if in_array('admin/nav/delete',$priv) || empty($priv)}
										<a href="{$delete_url}?id={$value[id]}" class="btnsm-danger item-remove">删除</a>
										{/if}
										{/if}
									</td>
									{else}
									<td>{$value[$v]}</td>
									{/if}
									{/if}
									{/if}
									{/loop}
								</tr>
								{/loop}
							</table>
						</div>
					</form>
					<div class="footer">
						{$pagemenu}
					</div>
				</div>
			</div>
		</section>
	</div>
</div>

<!--footer section start-->
{include admin.inc.footer}
<!--footer section end-->

<!--tmpl-script-->

<!-- template -->
<!--自定义start-->
<script id="defined_table" type="text/html">
	<div>
		<form id="defined_edit" class="form-horizontal">
			<input type="hidden" name="url" value="{$module}/{$action}/{$method}">
			<div class="de_title"><i></i>拖动改变顺序</div>
			<div class="cf">
				<div class="dd" id="nestable3">
					<ol class="dd-list">
						{loop $fields_arr_new $v}
						<li class="dd-item dd3-item" data-id="{$v}">
							<div class="dd-handle dd3-handle"></div><div class="dd3-content">
							<label class="css-checkbox">
								<input type="checkbox" {if in_array($v,$custom_field_arr)}checked="checked"{/if} name="field_arr[]" value="{$v}">
								<span>{$fields_arr[$v]}</span>
							</label>
						</div>
						</li>
						{/loop}
					</ol>
				</div>
			</div>
		</form>
	</div>
</script>
<!--自定义end-->

<script id="editpanel" type="text/html">
	<div>
		<form id="editpanel-form" class="form-horizontal">
			<div class="row">&nbsp</div>
			<!--tmpl-fieldlist-->

			<!-- input -->
			<div class="form-group">
				<label >导航名称 </label>
				<input  dtype="" class="form-control" maxlength="20" name="data[name]" placeholder="导航名称" required cname="导航名称" value="{[name]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- input -->
			<div class="form-group">
				<label >链接地址 </label>
				<input  dtype="url" class="form-control" maxlength="255" name="data[url]" placeholder="链接地址" required cname="链接地址" value="{[url]}" />
			</div>
			<p class="help-block"></p>
			
			<!-- switch -->
			<div class="form-group">
				<label>显示</label>
				<div>
					<label class="css-switch">
						<input type="checkbox" id="switch-display" name="data[display]" data-size="normal" {if $item[display]}checked{/if} data-on-text="是" data-off-text="否">
						<span></span>
					</label>

				</div>
			</div>
			
			<!-- switch -->
			<div class="form-group">
				<label>新窗口打开</label>
				<div>
					<label class="css-switch">
						<input type="checkbox" id="switch-blank" name="data[blank]" data-size="normal" {if $item[blank]}checked{/if} data-on-text="是" data-off-text="否">
						<span></span>
					</label>

				</div>
			</div>
			

			<!--tmpl-assocfields-->
		</form>
	</div>
</script>

<!-- pagescript -->
<script type="text/javascript">
	seajs.use("admin/admin_navindex",function (parameter){
		
		/**--tmpl-templatejavascript--**/
		
		<!--tmpl-templatejavascript-->
		parameter.detailUrl="{$detail_url}";
		parameter.deleteUrl="{$delete_url}";
		parameter.editUrl="{$do_edit_url}";
		parameter.upload_url="{$upload_url}";
		parameter.image_search_url="{$image_search_url}";
		parameter.image_list_url="{$image_list_url}";
		
		parameter.init();		
	});
</script>

<!--<script id="assocpage" type="text/html">
<div class="text-right">
	<ul class="pagination blog-pagination">
		<li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li>
		{[loop pages page]}

		<li {[if curr == page]}class="active"{[/if]}><a class="assoc-page" data-page="{[page]}"  href="javascript:void(0)">{[page]}</a></li>

		{[/loop]}
		<li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li>
	</ul>
</div>
</script>-->
</body>
</html>
